<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">
      <link rel="stylesheet" type="text/css" href="./estilos.css"/>  	
  	
<h:form id="formMembroProjeto" prependId="false">   
	<p:commandButton value="Projeto" action="#{projetoBean.viewProjeto}" immediate="true" />
	<p:commandButton value="Atividade" action="#{atividadeBean.consultarAtividade}" immediate="true"/>
 	<p:commandButton value="Milestone" action="#{milestoneBean.consultarMilestone}" immediate="true"/>
 	<p:commandButton value="Membro" action="#{projetoBean.membroProjeto}" immediate="true"/>
 	<p:commandButton value="Log" action="#{projetoBean.consultarLog}" immediate="true"/> 
    <p:panel id="panelUsuarioProjeto">  
    	<f:facet name="header">
    		<h:outputText value="Usuários do Projeto" styleClass="outputTextTitulo"/>
    	</f:facet>
        <p:growl id="growl" />   
    
    <p:dataTable id="tableMembroProjeto" value="#{projetoBean.listaMembroProjeto}"  var="membro" rowKey="#{membro.idUsuarioProjeto}" 
    			 selection="#{projetoBean.usuarioSelect}" selectionMode="single" style="padding-top:30px; width:40%; margin-bottom:10px;">  
  
        <p:column headerText="Nome do Usuario" style="width:48%;">  
      		<p:outputLabel value="#{membro.usuario.nome}"/>
        </p:column>  
        
        <p:column headerText="Email" style="width:48%;">  
      		<p:outputLabel value="#{membro.usuario.email}" />
        </p:column>  

        <p:column style="width:4%; float:center; text-align:center;" rendered="#{projetoBean.renderedGerente()}">  
        	<f:facet name="header">
        		Excluir
        	</f:facet>
         	<p:commandButton id="selectButtonExcluir" onclick="confirmation.show()" process="@this" type="buttom" icon="ui-icon-circle-close" title="Excluir" 
         					 disabled="#{projetoBean.disableGerente()}" rendered="#{projetoBean.renderedGerente()}" >
                <f:setPropertyActionListener value="#{membro}" target="#{projetoBean.usuarioSelect}" />  
            </p:commandButton>  
        </p:column> 

    </p:dataTable>  
    <p:commandButton value="Adicionar Membro" action="#{projetoBean.openDialogAdicionarMembro}" rendered="#{projetoBean.renderedGerente()}"/>
</p:panel>


 
</h:form> 
    <p:dialog id="confirmation" message="Informe o email para confirmar exclusão"  modal="false"
                header="Confirmar exclusão" widgetVar="confirmation" appendToBody="true"> 
                <h:form>
        <h:panelGroup id="pgDialogRemoveMembro">
        <h:panelGrid columns="2">
        	<p:outputLabel value="Email:"/>
        	<p:inputText value="#{projetoBean.emailExclusao}"/>
       </h:panelGrid> 
       <h:panelGrid columns="2">
       		<p:commandButton id="confirm" value="Excluir" oncomplete="confirmation.hide()" process="@this pgDialogRemoveMembro" 
                    action="#{projetoBean.excluirMembro}" update="pgDialogRemoveMembro"/>  
        	<p:commandButton id="decline" value="Cancelar" onclick="confirmation.hide()" type="button" />   
       </h:panelGrid> 
      </h:panelGroup>  
         </h:form>     
    </p:dialog>
<ui:include src="/membro/dialogAdicionarMembro.xhtml"></ui:include>

</ui:define>
</ui:composition>
